package com.xyzq.model.ya.data;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.apache.commons.lang.builder.ToStringBuilder;
import org.appfuse.model.BaseObject;

@Entity
@Table(name = "staff_month_report")
public class StaffMonthReport extends BaseObject implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 5286132223578836958L;

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	private Long id;
	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "FK_STAFF_STAFF", nullable = false)
	private Staff staff;
	@Column(name = "daily_assert", scale = 2)
	private Double dailyAssert;
	@Column(name = "daily_fund", scale = 2)
	private Double dailyFund;
	@Column(name = "daily_market_assert", scale = 2)
	private Double dailyMarketAssert;
	@Column(name = "daily_paper", scale = 2)
	private Double dailyPaper;
	@Column(name = "daily_money", scale = 2)
	private Double dailyMoney;
	@Column(scale = 2)
	private Double deal;
	@Column(scale = 2)
	private Double netCommission;
	private String month;
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "sub_time")
	private Date subTime;

	public void setStaffId(Integer staffId) {
		if (staff == null) {
			staff = new Staff();
		}
		this.staff.setStaffId(staffId);
	}

	public Long getId() {
		return id;
	}

	public Staff getStaff() {
		return staff;
	}

	public Double getDailyAssert() {
		return dailyAssert;
	}

	public Double getDailyFund() {
		return dailyFund;
	}

	public Double getDailyMarketAssert() {
		return dailyMarketAssert;
	}

	public Double getDailyPaper() {
		return dailyPaper;
	}

	public Double getDailyMoney() {
		return dailyMoney;
	}

	public Double getDeal() {
		return deal;
	}

	public Double getNetCommission() {
		return netCommission;
	}

	public String getMonth() {
		return month;
	}

	public Date getSubTime() {
		return subTime;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public void setStaff(Staff staff) {
		this.staff = staff;
	}

	public void setDailyAssert(Double dailyAssert) {
		this.dailyAssert = dailyAssert;
	}

	public void setDailyFund(Double dailyFund) {
		this.dailyFund = dailyFund;
	}

	public void setDailyMarketAssert(Double dailyMarketAssert) {
		this.dailyMarketAssert = dailyMarketAssert;
	}

	public void setDailyPaper(Double dailyPaper) {
		this.dailyPaper = dailyPaper;
	}

	public void setDailyMoney(Double dailyMoney) {
		this.dailyMoney = dailyMoney;
	}

	public void setDeal(Double deal) {
		this.deal = deal;
	}

	public void setNetCommission(Double netCommission) {
		this.netCommission = netCommission;
	}

	public void setMonth(String month) {
		this.month = month;
	}

	public void setSubTime(Date subTime) {
		this.subTime = subTime;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ ((dailyAssert == null) ? 0 : dailyAssert.hashCode());
		result = prime * result
				+ ((dailyFund == null) ? 0 : dailyFund.hashCode());
		result = prime
				* result
				+ ((dailyMarketAssert == null) ? 0 : dailyMarketAssert
						.hashCode());
		result = prime * result
				+ ((dailyMoney == null) ? 0 : dailyMoney.hashCode());
		result = prime * result
				+ ((dailyPaper == null) ? 0 : dailyPaper.hashCode());
		result = prime * result + ((deal == null) ? 0 : deal.hashCode());
		result = prime * result + ((id == null) ? 0 : id.hashCode());
		result = prime * result + ((month == null) ? 0 : month.hashCode());
		result = prime * result
				+ ((netCommission == null) ? 0 : netCommission.hashCode());
		result = prime * result + ((staff == null) ? 0 : staff.hashCode());
		result = prime * result + ((subTime == null) ? 0 : subTime.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		StaffMonthReport other = (StaffMonthReport) obj;
		if (dailyAssert == null) {
			if (other.dailyAssert != null)
				return false;
		} else if (!dailyAssert.equals(other.dailyAssert))
			return false;
		if (dailyFund == null) {
			if (other.dailyFund != null)
				return false;
		} else if (!dailyFund.equals(other.dailyFund))
			return false;
		if (dailyMarketAssert == null) {
			if (other.dailyMarketAssert != null)
				return false;
		} else if (!dailyMarketAssert.equals(other.dailyMarketAssert))
			return false;
		if (dailyMoney == null) {
			if (other.dailyMoney != null)
				return false;
		} else if (!dailyMoney.equals(other.dailyMoney))
			return false;
		if (dailyPaper == null) {
			if (other.dailyPaper != null)
				return false;
		} else if (!dailyPaper.equals(other.dailyPaper))
			return false;
		if (deal == null) {
			if (other.deal != null)
				return false;
		} else if (!deal.equals(other.deal))
			return false;
		if (id == null) {
			if (other.id != null)
				return false;
		} else if (!id.equals(other.id))
			return false;
		if (month == null) {
			if (other.month != null)
				return false;
		} else if (!month.equals(other.month))
			return false;
		if (netCommission == null) {
			if (other.netCommission != null)
				return false;
		} else if (!netCommission.equals(other.netCommission))
			return false;
		if (staff == null) {
			if (other.staff != null)
				return false;
		} else if (!staff.equals(other.staff))
			return false;
		if (subTime == null) {
			if (other.subTime != null)
				return false;
		} else if (!subTime.equals(other.subTime))
			return false;
		return true;
	}

	@Override
	public String toString() {
		ToStringBuilder builder = new ToStringBuilder(this);
		builder.append("id", id);
		builder.append("staff", staff);
		builder.append("dailyAssert", dailyAssert);
		builder.append("dailyFund", dailyFund);
		builder.append("dailyMarketAssert", dailyMarketAssert);
		builder.append("dailyPaper", dailyPaper);
		builder.append("dailyMoney", dailyMoney);
		builder.append("deal", deal);
		builder.append("netCommission", netCommission);
		builder.append("month", month);
		builder.append("subTime", subTime);
		return builder.toString();
	}

}
